<HTML><HEAD><TITLE>tool(++PredSpec)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Obsolete</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>tool(++PredSpec)</H1>
Declares PredSpec as a tool interface procedure.


<DL>
<DT><EM>PredSpec</EM></DT>
<DD>Expression of the form Atom/Integer.
</DD>
</DL>
<H3>This built-in predicate is obsolete!</H3>
<H2>Description</H2>
   Informs the system that the (may be not yet visible) procedure PredSpec
   is a tool interface procedure.  Normally, tool(PredSpecI, PredSpecB) is
   used to define a tool interface procedure and declare its body.
   However, if PredSpecI is not yet declared as a tool and if the system
   has already compiled some calls to it, the tool/2 declaration will cause
   an error since the system cannot provide the caller's home module for
   calls which are already compiled.

<P>
   Therefore, when there are modules which are compiled before the tool/2
   declaration but which call PredSpecI, tool/1 should be used before the
   first call to inform the system that this is a tool interface procedure.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>tool(++) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>PredSpec is not instantiated.
<DT><EM>(5) type error </EM>
<DD>PredSpec is instantiated, but not to an expression of the    form Atom/Integer.
<DT><EM>(62) inconsistent procedure redefinition </EM>
<DD>A call to PredSpec has already been compiled before the    tool declaration (``inconsistent procedure redefinition'').
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: tool(list_name/1). % declare as tool
                                  % procedure before
      yes.                        % compiling calls to it.
      [eclipse]: [user].
       p :- list_name(p).
       user compiled 52 bytes in 0.00 seconds
      yes.
      [eclipse]: tool_body(current_predicate/1,P,M),
              (import P from M).
      P = current_predicate_body / 2
      M = sepia_kernel
      yes.
      [eclipse]: tool(list_name/1,list_name_body/2).
      yes.
      [eclipse]: [user].
       :- export list_name/1.
       list_name_body(Name, Module) :-
               current_predicate_body(Name/A, Module),
               writeln(Name/A),
               fail.
       list_name_body(_, _).
       user compiled 260 bytes in 0.03 seconds
      yes.
      [eclipse]: module(m).
      [m]: [user].
       p(a,b,c,d,e).
       user compiled 84 bytes in 0.00 seconds
      yes.
      [m]: import list_name/1 from eclipse.
      yes.
      [m]: list_name(p).
      p / 5
      yes.
      [m]: module(eclipse).
      [eclipse]: list_name(p).
      p / 0
      yes.

Error:
      tool(L).            (Error 4).
      tool(list_name).    (Error 5).
      tool(list_name/n).  (Error 5).

      [eclipse]: [user].
       p :- t. % call compiled before tool declaration
       user compiled 32 bytes in 0.00 seconds
      yes.
      [eclipse]: tool(t/0). (Error 62).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/modules/tool-2.html">tool / 2</A>, <A HREF="../../kernel/modules/tool_body-3.html">tool_body / 3</A>
</BODY></HTML>
